﻿using System.Collections.Generic;
using System.Linq;
using WebProject.Core.Models;

namespace WebProject.Core.Repositories
{
    public class ProductionRepository : GenericRepository<Production>, IProductionRepository
    {
        public ProductionRepository(EfDbContext dbContext) : base(dbContext)
        {
        }

        public IList<Production> GetProductionByTypeId(int typeId)
        {
            return DbSet.SqlQuery(string.Format("select * from Production where ProductionTypeId={0}", typeId)).ToList();
        }

        public IList<Production> GetAll(bool isOnlyDisplayOnIndex)
        {
            if (!isOnlyDisplayOnIndex)
                return GetAll();
            return DbSet.SqlQuery("select * from Production where IsDisplayOnIndex=1").ToList();
        }
    }
}
